#!/bin/bash
# 每次执行，手动修改版本号

# arch x86
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build webhook.go
IMG=registry.cn-hangzhou.aliyuncs.com/fuxiao/ops:am-webhook-0.2.12

# arch arm
# CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build webhook.go
# IMG=harbor.yunyang.com.cn/prometheus/alertmanager-dingtalk-webhook:0.6.2-msg1-arm64

# docker打镜像
docker build -t ${IMG} .

# docker镜像上传到harbor仓库
if [ $? -eq 0 ]; then
    docker push ${IMG}
fi